From 86e0f164296129d634a29c6c5dbe061a620d5b3d Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Tue, 22 Jun 2004 10:45:04 +0000 Subject: [PATCH] bitkeeper revision 1.994.1.4 (40d80db0ELJvAwrBu8alZswoyKyPpw) Rename dom-control and scheduling interfaces for sanity and consistency. --- extras/mini-os/h/hypervisor.h | 6 +-- .../arch/xen/kernel/setup.c | 36 ++++--------- .../include/asm-xen/hypervisor.h | 6 +-- tools/examples/xc_dom_control.py | 22 ++++---- tools/examples/xc_dom_create.py | 2 +- tools/examples/xm_dom_control.py | 12 ++--- tools/examples/xm_dom_create.py | 2 +- tools/xc/lib/xc.h | 13 +++-- tools/xc/lib/xc_domain.c | 30 +++++------ tools/xc/lib/xc_linux_build.c | 2 +- tools/xc/lib/xc_linux_restore.c | 9 +--- tools/xc/lib/xc_linux_save.c | 12 ++--- tools/xc/lib/xc_netbsd_build.c | 2 +- tools/xc/lib/xc_private.c | 15 ------ tools/xc/lib/xc_private.h | 5 -- tools/xc/py/Xc.c | 53 +++++++++---------- tools/xend/lib/domain_controller.h | 31 ++++------- tools/xenmgr/lib/EventTypes.py | 4 +- tools/xenmgr/lib/XendClient.py | 8 +-- tools/xenmgr/lib/XendDomain.py | 20 +++---- tools/xenmgr/lib/XendDomainInfo.py | 6 +-- tools/xenmgr/lib/server/SrvDomain.py | 8 +-- tools/xenmgr/lib/xm/create.py | 2 +- tools/xenmgr/lib/xm/main.py | 16 +++--- xen/arch/x86/process.c | 2 +- xen/common/debug.c | 4 +- xen/common/dom0_ops.c | 30 +++++------ xen/common/domain.c | 9 ++-- xen/common/kernel.c | 4 +- xen/common/schedule.c | 7 +-- xen/common/shadow.c | 2 +- xen/include/hypervisor-ifs/dom0_ops.h | 25 +++++---- xen/include/hypervisor-ifs/hypervisor-if.h | 4 +- xen/include/xen/sched.h | 27 ++++------ 34 files changed, 186 insertions(+), 250 deletions(-) diff --git a/extras/mini-os/h/hypervisor.h b/extras/mini-os/h/hypervisor.h index b77e1fa170..e44c6b3573 100644 --- a/extras/mini-os/h/hypervisor.h +++ b/extras/mini-os/h/hypervisor.h @@ -148,7 +148,7 @@ static inline int HYPERVISOR_shutdown(void) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_shutdown << SCHEDOP_reasonshift)) + "b" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift)) : "memory" ); return ret; @@ -160,7 +160,7 @@ static inline int HYPERVISOR_reboot(void) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_reboot << SCHEDOP_reasonshift)) + "b" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift)) : "memory" ); return ret; @@ -173,7 +173,7 @@ static inline int HYPERVISOR_suspend(unsigned long srec) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_suspend << SCHEDOP_reasonshift)), + "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), "S" (srec) : "memory" ); return ret; diff --git a/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c b/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c index a70897c57e..b329632b78 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c @@ -1142,26 +1142,6 @@ void __init cpu_init (void) } -/****************************************************************************** - * Time-to-die callback handling. - */ - -static void shutdown_handler(ctrl_msg_t *msg, unsigned long id) -{ - extern void ctrl_alt_del(void); - ctrl_if_send_response(msg); - ctrl_alt_del(); -} - -static int __init setup_shutdown_event(void) -{ - ctrl_if_register_receiver(CMSG_SHUTDOWN, shutdown_handler, 0); - return 0; -} - -__initcall(setup_shutdown_event); - - /****************************************************************************** * Stop/pickle callback handling. */ @@ -1294,9 +1274,15 @@ static void suspend_task(void *unused) static struct tq_struct suspend_tq; -static void suspend_handler(ctrl_msg_t *msg, unsigned long id) +static void shutdown_handler(ctrl_msg_t *msg, unsigned long id) { - if ( !suspending ) + if ( msg->subtype != CMSG_SHUTDOWN_SUSPEND ) + { + extern void ctrl_alt_del(void); + ctrl_if_send_response(msg); + ctrl_alt_del(); + } + else if ( !suspending ) { suspending = 1; suspend_tq.routine = suspend_task; @@ -1310,10 +1296,10 @@ static void suspend_handler(ctrl_msg_t *msg, unsigned long id) ctrl_if_send_response(msg); } -static int __init setup_suspend_event(void) +static int __init setup_shutdown_event(void) { - ctrl_if_register_receiver(CMSG_SUSPEND, suspend_handler, 0); + ctrl_if_register_receiver(CMSG_SHUTDOWN, shutdown_handler, 0); return 0; } -__initcall(setup_suspend_event); +__initcall(setup_shutdown_event); diff --git a/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h index 23392a8f16..18051de97c 100644 --- a/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h +++ b/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h @@ -248,7 +248,7 @@ static inline int HYPERVISOR_shutdown(void) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_shutdown << SCHEDOP_reasonshift)) + "b" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift)) : "memory" ); return ret; @@ -260,7 +260,7 @@ static inline int HYPERVISOR_reboot(void) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_reboot << SCHEDOP_reasonshift)) + "b" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift)) : "memory" ); return ret; @@ -273,7 +273,7 @@ static inline int HYPERVISOR_suspend(unsigned long srec) __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_suspend | (STOPCODE_suspend << SCHEDOP_reasonshift)), + "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), "S" (srec) : "memory" ); return ret; diff --git a/tools/examples/xc_dom_control.py b/tools/examples/xc_dom_control.py index 5f74077b12..583d629c74 100755 --- a/tools/examples/xc_dom_control.py +++ b/tools/examples/xc_dom_control.py @@ -9,8 +9,8 @@ def usage (): print >>sys.stderr, """ Usage: %s [command] - stop [dom] -- pause a domain - start [dom] -- un-pause a domain + pause [dom] -- pause a domain + unpause [dom] -- un-pause a domain shutdown [dom] [[-w]] -- request a domain to shutdown (can specify 'all') (optionally wait for complete shutdown) destroy [dom] -- immediately terminate a domain @@ -45,21 +45,21 @@ dom = None if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]): dom = int(sys.argv[2]) -if cmd == 'stop': - rc = xc.domain_stop( dom=dom ) +if cmd == 'pause': + rc = xc.domain_pause( dom=dom ) -elif cmd == 'start': - rc = xc.domain_start( dom=dom ) +elif cmd == 'unpause': + rc = xc.domain_unpause( dom=dom ) elif cmd == 'shutdown': list = [] if dom != None: - rc = xc.domain_destroy( dom=dom, force=0 ) + rc = xc.domain_destroy( dom=dom ) # should be CMSG_SHUTDOWN list.append(dom) elif sys.argv[2] == 'all': for i in xc.domain_getinfo(): if i['dom'] != 0: # don't shutdown dom0! - ret = xc.domain_destroy( dom=i['dom'], force=0 ) + ret = xc.domain_destroy( dom=i['dom'] ) # should be CMSG_SHUTDOWN if ret !=0: rc = ret else: list.append(i['dom']) @@ -72,7 +72,7 @@ elif cmd == 'shutdown': time.sleep(1) elif cmd == 'destroy': - rc = xc.domain_destroy( dom=dom, force=1 ) + rc = xc.domain_destroy( dom=dom ) elif cmd == 'pincpu': @@ -90,8 +90,8 @@ elif cmd == 'list': run = (domain['running'] and 'r') or '-' block = (domain['blocked'] and 'b') or '-' - stop = (domain['stopped'] and 's') or '-' - susp = (domain['suspended'] and 'S') or '-' + stop = (domain['paused'] and 'p') or '-' + susp = (domain['shutdown'] and 's') or '-' crash = (domain['crashed'] and 'c') or '-' domain['state'] = run + block + stop + susp + crash diff --git a/tools/examples/xc_dom_create.py b/tools/examples/xc_dom_create.py index 0b4ede8583..bb3f441894 100755 --- a/tools/examples/xc_dom_create.py +++ b/tools/examples/xc_dom_create.py @@ -364,7 +364,7 @@ def make_domain(): if not nlb: print >>open('/proc/sys/net/ipv4/ip_nonlocal_bind','w'), '0' if not dontstart: - if xc.domain_start( dom=id ) < 0: + if xc.domain_unpause( dom=id ) < 0: print "Error starting domain" xc.domain_destroy ( dom=id ) sys.exit() diff --git a/tools/examples/xm_dom_control.py b/tools/examples/xm_dom_control.py index d098ee4a24..0cb9b100af 100755 --- a/tools/examples/xm_dom_control.py +++ b/tools/examples/xm_dom_control.py @@ -25,8 +25,8 @@ def usage (rc=0): Usage: %s [command] help -- print usage - stop [dom] -- pause a domain - start [dom] -- un-pause a domain + pause [dom] -- pause a domain + unpause [dom] -- un-pause a domain shutdown [dom] [[-w]] -- request a domain to shutdown (can specify 'all') (optionally wait for complete shutdown) destroy [dom] -- immediately terminate a domain @@ -89,11 +89,11 @@ if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]): if cmd == "help": usage() -elif cmd == 'stop': - rc = server.xend_domain_stop(dom) +elif cmd == 'pause': + rc = server.xend_domain_pause(dom) -elif cmd == 'start': - rc = server.xend_domain_start(dom) +elif cmd == 'unpause': + rc = server.xend_domain_unpause(dom) elif cmd == 'shutdown': doms = [] diff --git a/tools/examples/xm_dom_create.py b/tools/examples/xm_dom_create.py index 6c2f9674a7..d84efb1c92 100755 --- a/tools/examples/xm_dom_create.py +++ b/tools/examples/xm_dom_create.py @@ -305,7 +305,7 @@ def make_domain(config): else: console_port = None - if server.xend_domain_start(dom) < 0: + if server.xend_domain_unpause(dom) < 0: print "Error starting domain" server.xend_domain_halt(dom) sys.exit() diff --git a/tools/xc/lib/xc.h b/tools/xc/lib/xc.h index 1ca7ead8d0..4e75ebebef 100644 --- a/tools/xc/lib/xc.h +++ b/tools/xc/lib/xc.h @@ -25,8 +25,8 @@ int xc_interface_close(int xc_handle); typedef struct { u32 domid; unsigned int cpu; - unsigned int dying:1, crashed:1, suspended:1, - stopped:1, blocked:1, running:1; + unsigned int dying:1, crashed:1, shutdown:1, + paused:1, blocked:1, running:1; unsigned long nr_pages; unsigned long shared_info_frame; u64 cpu_time; @@ -40,13 +40,12 @@ int xc_domain_create(int xc_handle, const char *name, int cpu, u32 *pdomid); -int xc_domain_start(int xc_handle, +int xc_domain_pause(int xc_handle, u32 domid); -int xc_domain_stop(int xc_handle, - u32 domid); +int xc_domain_unpause(int xc_handle, + u32 domid); int xc_domain_destroy(int xc_handle, - u32 domid, - int force); + u32 domid); int xc_domain_pincpu(int xc_handle, u32 domid, int cpu); diff --git a/tools/xc/lib/xc_domain.c b/tools/xc/lib/xc_domain.c index a0e222718d..84a97ce679 100644 --- a/tools/xc/lib/xc_domain.c +++ b/tools/xc/lib/xc_domain.c @@ -30,34 +30,32 @@ int xc_domain_create(int xc_handle, } -int xc_domain_start(int xc_handle, +int xc_domain_pause(int xc_handle, u32 domid) { dom0_op_t op; - op.cmd = DOM0_STARTDOMAIN; - op.u.startdomain.domain = (domid_t)domid; + op.cmd = DOM0_PAUSEDOMAIN; + op.u.pausedomain.domain = (domid_t)domid; return do_dom0_op(xc_handle, &op); } -int xc_domain_stop(int xc_handle, - u32 domid) +int xc_domain_unpause(int xc_handle, + u32 domid) { dom0_op_t op; - op.cmd = DOM0_STOPDOMAIN; - op.u.stopdomain.domain = (domid_t)domid; + op.cmd = DOM0_UNPAUSEDOMAIN; + op.u.unpausedomain.domain = (domid_t)domid; return do_dom0_op(xc_handle, &op); } int xc_domain_destroy(int xc_handle, - u32 domid, - int force) + u32 domid) { dom0_op_t op; op.cmd = DOM0_DESTROYDOMAIN; op.u.destroydomain.domain = (domid_t)domid; - op.u.destroydomain.force = !!force; return do_dom0_op(xc_handle, &op); } @@ -94,12 +92,12 @@ int xc_domain_getinfo(int xc_handle, info->cpu = (op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK; - info->dying = (op.u.getdomaininfo.flags & DOMFLAGS_DYING); - info->crashed = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED); - info->suspended = (op.u.getdomaininfo.flags & DOMFLAGS_SUSPENDED); - info->stopped = (op.u.getdomaininfo.flags & DOMFLAGS_STOPPED); - info->blocked = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED); - info->running = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING); + info->dying = (op.u.getdomaininfo.flags & DOMFLAGS_DYING); + info->crashed = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED); + info->shutdown = (op.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN); + info->paused = (op.u.getdomaininfo.flags & DOMFLAGS_PAUSED); + info->blocked = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED); + info->running = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING); info->nr_pages = op.u.getdomaininfo.tot_pages; info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10); diff --git a/tools/xc/lib/xc_linux_build.c b/tools/xc/lib/xc_linux_build.c index 16d0dbb9d1..ceace01b00 100644 --- a/tools/xc/lib/xc_linux_build.c +++ b/tools/xc/lib/xc_linux_build.c @@ -436,7 +436,7 @@ int xc_linux_build(int xc_handle, PERROR("Could not get info on domain"); goto error_out; } - if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) || + if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || (ctxt->pt_base != 0) ) { ERROR("Domain is already constructed"); diff --git a/tools/xc/lib/xc_linux_restore.c b/tools/xc/lib/xc_linux_restore.c index 5900919e32..7387cddcf0 100644 --- a/tools/xc/lib/xc_linux_restore.c +++ b/tools/xc/lib/xc_linux_restore.c @@ -606,13 +606,8 @@ int xc_linux_restore(int xc_handle, out: - if ( rc != 0 ) - { - if ( dom != 0 ) - { - xc_domain_destroy( xc_handle, dom, 1 ); - } - } + if ( (rc != 0) && (dom != 0) ) + xc_domain_destroy(xc_handle, dom); if ( mmu != NULL ) free(mmu); diff --git a/tools/xc/lib/xc_linux_save.c b/tools/xc/lib/xc_linux_save.c index 35fe92f32d..2d035ff7ea 100644 --- a/tools/xc/lib/xc_linux_save.c +++ b/tools/xc/lib/xc_linux_save.c @@ -273,10 +273,9 @@ int xc_linux_save(int xc_handle, } /* Ensure that the domain exists, and that it is stopped. */ - - if ( xc_domain_stop_sync( xc_handle, domid, &op, &ctxt ) ) + if ( xc_domain_pause(xc_handle, domid) ) { - PERROR("Could not sync stop domain"); + PERROR("Could not pause domain"); goto out; } @@ -381,9 +380,9 @@ int xc_linux_save(int xc_handle, goto out; } - if ( xc_domain_start( xc_handle, domid ) < 0 ) + if ( xc_domain_unpause(xc_handle, domid) < 0 ) { - ERROR("Couldn't restart domain"); + ERROR("Couldn't unpause domain"); goto out; } @@ -754,8 +753,7 @@ int xc_linux_save(int xc_handle, DPRINTF("Start last iteration\n"); last_iter = 1; - xc_domain_stop_sync( xc_handle, domid, &op, NULL ); - + xc_domain_pause(xc_handle, domid); } if ( xc_shadow_control( xc_handle, domid, diff --git a/tools/xc/lib/xc_netbsd_build.c b/tools/xc/lib/xc_netbsd_build.c index a0c73fa1bc..04a47b5068 100644 --- a/tools/xc/lib/xc_netbsd_build.c +++ b/tools/xc/lib/xc_netbsd_build.c @@ -258,7 +258,7 @@ int xc_netbsd_build(int xc_handle, PERROR("Could not get info on domain"); goto error_out; } - if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) || + if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || (op.u.getdomaininfo.ctxt->pt_base != 0) ) { ERROR("Domain is already constructed"); diff --git a/tools/xc/lib/xc_private.c b/tools/xc/lib/xc_private.c index ccf5f97299..344f48254d 100644 --- a/tools/xc/lib/xc_private.c +++ b/tools/xc/lib/xc_private.c @@ -199,19 +199,6 @@ int finish_mmu_updates(int xc_handle, mmu_t *mmu) } -/***********************************************************/ - -/* this function is a hack until we get proper synchronous domain stop */ - -int xc_domain_stop_sync( int xc_handle, domid_t domid, - dom0_op_t *op, full_execution_context_t *ctxt) -{ - op->cmd = DOM0_STOPDOMAIN; - op->u.stopdomain.domain = (domid_t)domid; - do_dom0_op(xc_handle, op); - return 0; -} - long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid ) { dom0_op_t op; @@ -229,8 +216,6 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid ) } -/**********************************************************************/ - /* This is shared between save and restore, and may generally be useful. */ unsigned long csum_page (void * page) { diff --git a/tools/xc/lib/xc_private.h b/tools/xc/lib/xc_private.h index 6602cf7a9f..81213cff21 100644 --- a/tools/xc/lib/xc_private.h +++ b/tools/xc/lib/xc_private.h @@ -200,11 +200,6 @@ int mfn_mapper_flush_queue(mfn_mapper_t *t); void * mfn_mapper_queue_entry(mfn_mapper_t *t, int offset, unsigned long mfn, int size ); -/*********************/ - -int xc_domain_stop_sync( int xc_handle, domid_t dom, - dom0_op_t *op, full_execution_context_t *ctxt ); - long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid ); #endif /* __XC_PRIVATE_H__ */ diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c index 2ece932085..343d118bbc 100644 --- a/tools/xc/py/Xc.c +++ b/tools/xc/py/Xc.c @@ -55,7 +55,7 @@ static PyObject *pyxc_domain_create(PyObject *self, return PyInt_FromLong(dom); } -static PyObject *pyxc_domain_start(PyObject *self, +static PyObject *pyxc_domain_pause(PyObject *self, PyObject *args, PyObject *kwds) { @@ -68,16 +68,16 @@ static PyObject *pyxc_domain_start(PyObject *self, if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) return NULL; - if ( xc_domain_start(xc->xc_handle, dom) != 0 ) + if ( xc_domain_pause(xc->xc_handle, dom) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); return zero; } -static PyObject *pyxc_domain_stop(PyObject *self, - PyObject *args, - PyObject *kwds) +static PyObject *pyxc_domain_unpause(PyObject *self, + PyObject *args, + PyObject *kwds) { XcObject *xc = (XcObject *)self; @@ -88,7 +88,7 @@ static PyObject *pyxc_domain_stop(PyObject *self, if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) return NULL; - if ( xc_domain_stop(xc->xc_handle, dom) != 0 ) + if ( xc_domain_unpause(xc->xc_handle, dom) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); @@ -102,15 +102,13 @@ static PyObject *pyxc_domain_destroy(PyObject *self, XcObject *xc = (XcObject *)self; u32 dom; - int force = 0; - static char *kwd_list[] = { "dom", "force", NULL }; + static char *kwd_list[] = { "dom", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, - &dom, &force) ) + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) return NULL; - if ( xc_domain_destroy(xc->xc_handle, dom, force) != 0 ) + if ( xc_domain_destroy(xc->xc_handle, dom) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); @@ -171,8 +169,8 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, "cpu", info[i].cpu, "dying", info[i].dying, "crashed", info[i].crashed, - "suspended", info[i].suspended, - "stopped", info[i].stopped, + "shutdown", info[i].shutdown, + "paused", info[i].paused, "blocked", info[i].blocked, "running", info[i].running, "mem_kb", info[i].nr_pages*4, @@ -270,7 +268,7 @@ static PyObject *pyxc_linux_save(PyObject *self, if ( rc == 0 ) { printf("Migration succesful -- destroy local copy\n"); - xc_domain_destroy( xc->xc_handle, dom, 1 ); + xc_domain_destroy(xc->xc_handle, dom); close(sd); Py_INCREF(zero); return zero; @@ -281,7 +279,7 @@ static PyObject *pyxc_linux_save(PyObject *self, serr: printf("Migration failed -- restart local copy\n"); - xc_domain_start( xc->xc_handle, dom ); + xc_domain_unpause(xc->xc_handle, dom); PyErr_SetFromErrno(xc_error); if ( sd >= 0 ) close(sd); return NULL; @@ -327,7 +325,7 @@ static PyObject *pyxc_linux_save(PyObject *self, /* kill domain. We don't want to do this for checkpointing, but if we don't do it here I think people will hurt themselves by accident... */ - xc_domain_destroy( xc->xc_handle, dom, 1 ); + xc_domain_destroy(xc->xc_handle, dom); gzclose(gfd); close(fd); @@ -1015,26 +1013,25 @@ static PyMethodDef pyxc_methods[] = { " name [str, '(anon)']: Informative textual name.\n\n" "Returns: [int] new domain identifier; -1 on error.\n" }, - { "domain_start", - (PyCFunction)pyxc_domain_start, + { "domain_pause", + (PyCFunction)pyxc_domain_pause, METH_VARARGS | METH_KEYWORDS, "\n" - "Start execution of a domain.\n" - " dom [int]: Identifier of domain to be started.\n\n" + "Temporarily pause execution of a domain.\n" + " dom [int]: Identifier of domain to be paused.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, - { "domain_stop", - (PyCFunction)pyxc_domain_stop, + { "domain_unpause", + (PyCFunction)pyxc_domain_unpause, METH_VARARGS | METH_KEYWORDS, "\n" - "Stop execution of a domain.\n" - " dom [int]: Identifier of domain to be stopped.\n\n" + "(Re)start execution of a domain.\n" + " dom [int]: Identifier of domain to be unpaused.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, { "domain_destroy", (PyCFunction)pyxc_domain_destroy, METH_VARARGS | METH_KEYWORDS, "\n" "Destroy a domain.\n" - " dom [int]: Identifier of domain to be destroyed.\n" - " force [int, 0]: Bool - force immediate destruction?\n\n" + " dom [int]: Identifier of domain to be destroyed.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, { "domain_pincpu", @@ -1059,8 +1056,8 @@ static PyMethodDef pyxc_methods[] = { " cpu [int]: CPU to which this domain is bound\n" " dying [int]: Bool - is the domain dying?\n" " crashed [int]: Bool - has the domain crashed?\n" - " suspended[int]: Bool - has the domain suspended itself?\n" - " stopped [int]: Bool - is the domain stopped by control software?\n" + " shutdown [int]: Bool - has the domain shut itself down?\n" + " paused [int]: Bool - is the domain paused by control software?\n" " blocked [int]: Bool - is the domain blocked waiting for an event?\n" " running [int]: Bool - is the domain currently running?\n" " mem_kb [int]: Memory reservation, in kilobytes\n" diff --git a/tools/xend/lib/domain_controller.h b/tools/xend/lib/domain_controller.h index af202b5ec3..300426a879 100644 --- a/tools/xend/lib/domain_controller.h +++ b/tools/xend/lib/domain_controller.h @@ -29,13 +29,13 @@ typedef struct { /* - * Stop codes for SCHEDOP_suspend. These are opaque to Xen but interpreted by - * control software to determine appropriate action. + * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be + * interpreted by control software to determine the appropriate action. These + * are only really advisories: the controller can actually do as it likes. */ - -#define STOPCODE_shutdown 0 /* Domain exited normally. Clean up and kill. */ -#define STOPCODE_reboot 1 /* Clean up, kill, and then restart. */ -#define STOPCODE_suspend 2 /* Clean up, save suspend info, kill. */ +#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */ +#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ +#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ /* @@ -69,7 +69,6 @@ typedef struct { #define CMSG_BLKIF_FE 2 /* Block-device frontend */ #define CMSG_NETIF_BE 3 /* Network-device backend */ #define CMSG_NETIF_FE 4 /* Network-device frontend */ -#define CMSG_SUSPEND 5 /* Suspend messages */ #define CMSG_SHUTDOWN 6 /* Shutdown messages */ @@ -518,16 +517,6 @@ typedef struct { } PACKED netif_be_driver_status_changed_t; /* 4 bytes */ -/****************************************************************************** - * SUSPEND DEFINITIONS - */ - -/* - * Subtypes for console messages. - */ -/* None. */ - - /****************************************************************************** * CONSOLE DEFINITIONS */ @@ -535,9 +524,9 @@ typedef struct { /* * Subtypes for console messages. */ -#define CMSG_SHUTDOWN_HALT 0 /* Shutdown and halt (don't die). */ -#define CMSG_SHUTDOWN_POWEROFF 1 /* 'Poweroff' => clean death. */ -#define CMSG_SHUTDOWN_REBOOT 2 /* Shutdown and restart. */ - +#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */ +#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */ +#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */ + /* SHUTDOWN_suspend. */ #endif /* __DOMAIN_CONTROLLER_H__ */ diff --git a/tools/xenmgr/lib/EventTypes.py b/tools/xenmgr/lib/EventTypes.py index 3d4230e2ba..c8d5e62aa7 100644 --- a/tools/xenmgr/lib/EventTypes.py +++ b/tools/xenmgr/lib/EventTypes.py @@ -5,8 +5,8 @@ ## xend.domain.destroy: dom, reason:died/crashed ## xend.domain.up ? -## xend.domain.start: dom -## xend.domain.stop: dom +## xend.domain.unpause: dom +## xend.domain.pause: dom ## xend.domain.shutdown: dom ## xend.domain.halt: dom diff --git a/tools/xenmgr/lib/XendClient.py b/tools/xenmgr/lib/XendClient.py index 76f49f49bd..965633a421 100644 --- a/tools/xenmgr/lib/XendClient.py +++ b/tools/xenmgr/lib/XendClient.py @@ -187,13 +187,13 @@ class Xend: def xend_domain(self, id): return xend_get(self.domainurl(id)) - def xend_domain_start(self, id): + def xend_domain_unpause(self, id): return xend_call(self.domainurl(id), - {'op' : 'start'}) + {'op' : 'unpause'}) - def xend_domain_stop(self, id): + def xend_domain_pause(self, id): return xend_call(self.domainurl(id), - {'op' : 'stop'}) + {'op' : 'pause'}) def xend_domain_shutdown(self, id): return xend_call(self.domainurl(id), diff --git a/tools/xenmgr/lib/XendDomain.py b/tools/xenmgr/lib/XendDomain.py index 94afe3e87d..659292058b 100644 --- a/tools/xenmgr/lib/XendDomain.py +++ b/tools/xenmgr/lib/XendDomain.py @@ -188,18 +188,18 @@ class XendDomain: self.refresh_domain(id) return self.domain[id] - def domain_start(self, id): - """Start domain running. + def domain_unpause(self, id): + """(Re)start domain running. """ dom = int(id) - eserver.inject('xend.domain.start', id) - return xc.domain_start(dom=dom) + eserver.inject('xend.domain.unpause', id) + return xc.domain_unpause(dom=dom) - def domain_stop(self, id): - """Stop domain running. + def domain_pause(self, id): + """Pause domain execution. """ dom = int(id) - return xc.domain_stop(dom=dom) + return xc.domain_pause(dom=dom) def domain_shutdown(self, id): """Shutdown domain (nicely). @@ -208,7 +208,7 @@ class XendDomain: if dom <= 0: return 0 eserver.inject('xend.domain.shutdown', id) - val = xc.domain_destroy(dom=dom, force=0) + val = xc.domain_destroy(dom=dom) # FIXME -- send CMSG_SHUTDOWN self.refresh() return val @@ -219,7 +219,7 @@ class XendDomain: if dom <= 0: return 0 eserver.inject('xend.domain.halt', id) - val = xc.domain_destroy(dom=dom, force=1) + val = xc.domain_destroy(dom=dom) self.refresh() return val @@ -233,7 +233,7 @@ class XendDomain: """Save domain state to file, halt domain. """ dom = int(id) - self.domain_stop(id) + self.domain_pause(id) eserver.inject('xend.domain.save', id) rc = xc.linux_save(dom=dom, state_file=dst, progress=progress) if rc == 0: diff --git a/tools/xenmgr/lib/XendDomainInfo.py b/tools/xenmgr/lib/XendDomainInfo.py index 61a9b21c5a..c41ac73b50 100644 --- a/tools/xenmgr/lib/XendDomainInfo.py +++ b/tools/xenmgr/lib/XendDomainInfo.py @@ -113,8 +113,8 @@ class XendDomainInfo: if self.info: run = (self.info['running'] and 'r') or '-' block = (self.info['blocked'] and 'b') or '-' - stop = (self.info['stopped'] and 's') or '-' - susp = (self.info['suspended'] and 'S') or '-' + stop = (self.info['paused'] and 'p') or '-' + susp = (self.info['shutdown'] and 's') or '-' crash = (self.info['crashed'] and 'c') or '-' state = run + block + stop + susp + crash sxpr.append(['cpu', self.info['cpu']]) @@ -172,7 +172,7 @@ class XendDomainInfo: def destroy(self): if self.dom <= 0: return 0 - return xc.domain_destroy(dom=self.dom, force=1) + return xc.domain_destroy(dom=self.dom) def show(self): """Print virtual machine info. diff --git a/tools/xenmgr/lib/server/SrvDomain.py b/tools/xenmgr/lib/server/SrvDomain.py index 0ef5676941..07d3cfa7de 100644 --- a/tools/xenmgr/lib/server/SrvDomain.py +++ b/tools/xenmgr/lib/server/SrvDomain.py @@ -18,12 +18,12 @@ class SrvDomain(SrvDir): self.xd = XendDomain.instance() self.xconsole = XendConsole.instance() - def op_start(self, op, req): - val = self.xd.domain_start(self.dom.id) + def op_unpause(self, op, req): + val = self.xd.domain_unpause(self.dom.id) return val - def op_stop(self, op, req): - val = self.xd.domain_stop(self.dom.id) + def op_pause(self, op, req): + val = self.xd.domain_pause(self.dom.id) return val def op_shutdown(self, op, req): diff --git a/tools/xenmgr/lib/xm/create.py b/tools/xenmgr/lib/xm/create.py index 863227ad4c..4c1804a7ac 100644 --- a/tools/xenmgr/lib/xm/create.py +++ b/tools/xenmgr/lib/xm/create.py @@ -270,7 +270,7 @@ def make_domain(opts, config): else: console_port = None - if server.xend_domain_start(dom) < 0: + if server.xend_domain_unpause(dom) < 0: server.xend_domain_halt(dom) opts.err("Failed to start domain %d" % dom) opts.info("Started domain %d, console on port %d" diff --git a/tools/xenmgr/lib/xm/main.py b/tools/xenmgr/lib/xm/main.py index 4c70717521..9b2125a7c5 100644 --- a/tools/xenmgr/lib/xm/main.py +++ b/tools/xenmgr/lib/xm/main.py @@ -101,25 +101,25 @@ class Xm: """Shutdown a domain.""" shutdown.main(args) - def xm_stop(self, help, args): - """Stop execution of a domain.""" + def xm_pause(self, help, args): + """Pause execution of a domain.""" if help: print args[0], 'DOM' - print '\nStop execution of domain DOM.' + print '\nPause execution of domain DOM.' return if len(args) < 2: self.err("%s: Missing domain" % args[0]) dom = args[1] - server.xend_domain_stop(dom) + server.xend_domain_pause(dom) - def xm_start(self, help, args): - """Start execution of a domain.""" + def xm_unpause(self, help, args): + """(Re)start execution of a domain.""" if help: print args[0], 'DOM' - print '\nStart execution of domain DOM.' + print '\n(Re)start execution of domain DOM.' return if len(args) < 2: self.err("%s: Missing domain" % args[0]) dom = args[1] - server.xend_domain_start(dom) + server.xend_domain_unpause(dom) def xm_pincpu(self, help, args): """Pin a domain to a cpu. """ diff --git a/xen/arch/x86/process.c b/xen/arch/x86/process.c index dbc7eb2b7a..d3bf5ab4b8 100644 --- a/xen/arch/x86/process.c +++ b/xen/arch/x86/process.c @@ -76,7 +76,7 @@ void startup_cpu_idle_loop(void) { /* Just some sanity to ensure that the scheduler is set up okay. */ ASSERT(current->domain == IDLE_DOMAIN_ID); - domain_start(current); + domain_unpause_by_systemcontroller(current); __enter_scheduler(); /* diff --git a/xen/common/debug.c b/xen/common/debug.c index ce911bd11f..fd2d7d28c3 100644 --- a/xen/common/debug.c +++ b/xen/common/debug.c @@ -52,7 +52,7 @@ void pdb_do_debug (dom0_op_t *op) struct domain *d = find_domain_by_id(op->u.debug.domain); if ( d != NULL ) { - domain_start(d); + domain_unpause_by_systemcontroller(d); put_domain(d); } else @@ -94,7 +94,7 @@ void pdb_do_debug (dom0_op_t *op) if ( d != NULL ) { - domain_stop(d); + domain_pause_by_systemcontroller(d); put_domain(d); } else diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 7af451bfe5..f999bd4536 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -80,16 +80,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_STARTDOMAIN: + case DOM0_PAUSEDOMAIN: { - struct domain *d = find_domain_by_id(op->u.startdomain.domain); + struct domain *d = find_domain_by_id(op->u.pausedomain.domain); ret = -ESRCH; if ( d != NULL ) { ret = -EINVAL; - if ( test_bit(DF_CONSTRUCTED, &d->flags) ) + if ( d != current ) { - domain_start(d); + domain_pause_by_systemcontroller(d); ret = 0; } put_domain(d); @@ -97,16 +97,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_STOPDOMAIN: + case DOM0_UNPAUSEDOMAIN: { - struct domain *d = find_domain_by_id(op->u.stopdomain.domain); + struct domain *d = find_domain_by_id(op->u.unpausedomain.domain); ret = -ESRCH; if ( d != NULL ) { ret = -EINVAL; - if ( d != current ) + if ( test_bit(DF_CONSTRUCTED, &d->flags) ) { - domain_stop(d); + domain_unpause_by_systemcontroller(d); ret = 0; } put_domain(d); @@ -299,16 +299,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op) strcpy(op->u.getdomaininfo.name, d->name); op->u.getdomaininfo.flags = - (test_bit(DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) | - (test_bit(DF_CRASHED, &d->flags) ? DOMFLAGS_CRASHED : 0) | - (test_bit(DF_SUSPENDED, &d->flags) ? DOMFLAGS_SUSPENDED : 0) | - (test_bit(DF_STOPPED, &d->flags) ? DOMFLAGS_STOPPED : 0) | - (test_bit(DF_BLOCKED, &d->flags) ? DOMFLAGS_BLOCKED : 0) | - (test_bit(DF_RUNNING, &d->flags) ? DOMFLAGS_RUNNING : 0); + (test_bit(DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) | + (test_bit(DF_CRASHED, &d->flags) ? DOMFLAGS_CRASHED : 0) | + (test_bit(DF_SHUTDOWN, &d->flags) ? DOMFLAGS_SHUTDOWN : 0) | + (test_bit(DF_CTRLPAUSE, &d->flags) ? DOMFLAGS_PAUSED : 0) | + (test_bit(DF_BLOCKED, &d->flags) ? DOMFLAGS_BLOCKED : 0) | + (test_bit(DF_RUNNING, &d->flags) ? DOMFLAGS_RUNNING : 0); op->u.getdomaininfo.flags |= d->processor << DOMFLAGS_CPUSHIFT; op->u.getdomaininfo.flags |= - d->suspend_code << DOMFLAGS_SUSPCODESHIFT; + d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT; op->u.getdomaininfo.tot_pages = d->tot_pages; op->u.getdomaininfo.max_pages = d->max_pages; diff --git a/xen/common/domain.c b/xen/common/domain.c index d6a43a4746..97de78159e 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -193,19 +194,19 @@ void domain_crash(void) BUG(); } -void domain_suspend(u8 reason) +void domain_shutdown(u8 reason) { struct domain *d; if ( current->domain == 0 ) { extern void machine_restart(char *); - printk("Domain 0 halted: rebooting machine!\n"); + printk("Domain 0 shutdown: rebooting machine!\n"); machine_restart(0); } - current->suspend_code = reason; - set_bit(DF_SUSPENDED, ¤t->flags); + current->shutdown_code = reason; + set_bit(DF_SHUTDOWN, ¤t->flags); d = find_domain_by_id(0); send_guest_virq(d, VIRQ_DOM_EXC); diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 2b6d1ec021..6ff886985a 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -286,8 +286,8 @@ void cmain(unsigned long magic, multiboot_info_t *mbi) init_trace_bufs(); - domain_start(current); - domain_start(new_dom); + domain_unpause_by_systemcontroller(current); + domain_unpause_by_systemcontroller(new_dom); startup_cpu_idle_loop(); } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index d9cb33fdb5..a43e725db6 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -129,7 +129,8 @@ struct domain *alloc_domain_struct(void) */ void sched_add_domain(struct domain *d) { - set_bit(DF_STOPPED, &d->flags); + /* Must be unpaused by control software to start execution. */ + set_bit(DF_CTRLPAUSE, &d->flags); if ( d->domain != IDLE_DOMAIN_ID ) { @@ -269,9 +270,9 @@ long do_sched_op(unsigned long op) break; } - case SCHEDOP_suspend: + case SCHEDOP_shutdown: { - domain_suspend((u8)(op >> SCHEDOP_reasonshift)); + domain_shutdown((u8)(op >> SCHEDOP_reasonshift)); break; } diff --git a/xen/common/shadow.c b/xen/common/shadow.c index 8936a6422d..7b20e57f1d 100644 --- a/xen/common/shadow.c +++ b/xen/common/shadow.c @@ -417,7 +417,7 @@ static int shadow_mode_table_op(struct domain *d, /* Might as well stop the domain as an optimization. */ if ( zero ) - domain_stop(d); + domain_pause_by_systemcontroller(d); break; } diff --git a/xen/include/hypervisor-ifs/dom0_ops.h b/xen/include/hypervisor-ifs/dom0_ops.h index d1cf9c1fd5..a1df5cb23c 100644 --- a/xen/include/hypervisor-ifs/dom0_ops.h +++ b/xen/include/hypervisor-ifs/dom0_ops.h @@ -19,7 +19,7 @@ * This makes sure that old versions of dom0 tools will stop working in a * well-defined way (rather than crashing the machine, for instance). */ -#define DOM0_INTERFACE_VERSION 0xAAAA000F +#define DOM0_INTERFACE_VERSION 0xAAAA0010 #define MAX_DOMAIN_NAME 16 @@ -63,20 +63,19 @@ typedef struct { typedef struct { /* IN variables. */ domid_t domain; /* 0 */ - u32 force; /* 4 */ -} PACKED dom0_destroydomain_t; /* 8 bytes */ +} PACKED dom0_destroydomain_t; /* 4 bytes */ -#define DOM0_STARTDOMAIN 10 +#define DOM0_PAUSEDOMAIN 10 typedef struct { /* IN parameters. */ domid_t domain; /* 0 */ -} PACKED dom0_startdomain_t; /* 4 bytes */ +} PACKED dom0_pausedomain_t; /* 4 bytes */ -#define DOM0_STOPDOMAIN 11 +#define DOM0_UNPAUSEDOMAIN 11 typedef struct { /* IN parameters. */ domid_t domain; /* 0 */ -} PACKED dom0_stopdomain_t; /* 4 bytes */ +} PACKED dom0_unpausedomain_t; /* 4 bytes */ #define DOM0_GETDOMAININFO 12 typedef struct { @@ -85,14 +84,14 @@ typedef struct { /* OUT variables. */ #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */ #define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */ -#define DOMFLAGS_SUSPENDED (1<<2) /* Domain voluntarily halted it execution. */ -#define DOMFLAGS_STOPPED (1<<3) /* Currently stopped by control software. */ +#define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut itself down. */ +#define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */ #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */ #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */ #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */ #define DOMFLAGS_CPUSHIFT 8 -#define DOMFLAGS_SUSPCODEMASK 255 /* DOMSTATE_SUSPENDED guest-supplied code. */ -#define DOMFLAGS_SUSPCODESHIFT 16 +#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */ +#define DOMFLAGS_SHUTDOWNSHIFT 16 u32 flags; /* 4 */ u8 name[MAX_DOMAIN_NAME]; /* 8 */ full_execution_context_t *ctxt; /* 24 */ /* NB. IN/OUT variable. */ @@ -319,8 +318,8 @@ typedef struct { union { /* 8 */ u32 dummy[18]; /* 72 bytes */ dom0_createdomain_t createdomain; - dom0_startdomain_t startdomain; - dom0_stopdomain_t stopdomain; + dom0_pausedomain_t pausedomain; + dom0_unpausedomain_t unpausedomain; dom0_destroydomain_t destroydomain; dom0_getmemlist_t getmemlist; dom0_schedctl_t schedctl; diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h index 35a3d4056c..a8a59eca5b 100644 --- a/xen/include/hypervisor-ifs/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/hypervisor-if.h @@ -164,9 +164,9 @@ */ #define SCHEDOP_yield 0 /* Give up the CPU voluntarily. */ #define SCHEDOP_block 1 /* Block until an event is received. */ -#define SCHEDOP_suspend 2 /* Stop executing this domain. */ +#define SCHEDOP_shutdown 2 /* Stop executing this domain. */ #define SCHEDOP_cmdmask 255 /* 8-bit command. */ -#define SCHEDOP_reasonshift 8 /* 8-bit suspend code. (SCHEDOP_suspend) */ +#define SCHEDOP_reasonshift 8 /* 8-bit reason code. (SCHEDOP_shutdown) */ /* * Commands to HYPERVISOR_console_io(). diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 6a223663ca..467a6878f5 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -96,7 +96,7 @@ struct domain /* Scheduling. */ struct list_head run_list; - int suspend_code; /* code value from OS (if DF_SUSPENDED). */ + int shutdown_code; /* code value from OS (if DF_SHUTDOWN). */ s_time_t lastschd; /* time this domain was last scheduled */ s_time_t lastdeschd; /* time this domain was last descheduled */ s_time_t cpu_time; /* total CPU time received till now */ @@ -193,7 +193,7 @@ struct domain *find_last_domain(void); extern void domain_destruct(struct domain *d); extern void domain_kill(struct domain *d); extern void domain_crash(void); -extern void domain_suspend(u8 reason); +extern void domain_shutdown(u8 reason); /* arch/process.c */ void new_thread(struct domain *d, @@ -254,8 +254,8 @@ extern struct domain *task_list; #define DF_CONSOLEWRITEBUG 6 /* Has this domain used the obsolete console? */ #define DF_PHYSDEV 7 /* May this domain do IO to physical devices? */ #define DF_BLOCKED 8 /* Domain is blocked waiting for an event. */ -#define DF_STOPPED 9 /* Domain is stopped by control software. */ -#define DF_SUSPENDED 10 /* Guest suspended its execution for some reason. */ +#define DF_CTRLPAUSE 9 /* Domain is paused by controller software. */ +#define DF_SHUTDOWN 10 /* Guest shut itself down for some reason. */ #define DF_CRASHED 11 /* Domain crashed inside Xen, cannot continue. */ #define DF_DYING 12 /* Death rattle. */ #define DF_RUNNING 13 /* Currently running on a CPU. */ @@ -264,8 +264,8 @@ extern struct domain *task_list; static inline int domain_runnable(struct domain *d) { return ( (atomic_read(&d->pausecnt) == 0) && - !(d->flags & ((1<flags & ((1<flags) ) - domain_wake(d); -} - -static inline void domain_stop(struct domain *d) -{ - ASSERT(d != current); - if ( !test_and_set_bit(DF_STOPPED, &d->flags) ) + if ( !test_and_set_bit(DF_CTRLPAUSE, &d->flags) ) domain_sleep(d); } -static inline void domain_start(struct domain *d) +static inline void domain_unpause_by_systemcontroller(struct domain *d) { ASSERT(d != current); - if ( test_and_clear_bit(DF_STOPPED, &d->flags) ) + if ( test_and_clear_bit(DF_CTRLPAUSE, &d->flags) ) domain_wake(d); } -- 2.30.2